package com.cn.zmc.design.proxy;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ProxyPattern {

    public static void main(String[] args) {


    }



    public interface Subject {

        void request();

    }

    public static class ConcreteSubject implements Subject {

        public void request() {
            System.out.println("执行请求");
        }

    }
    public static class Proxy implements Subject {

        private Subject subject;

        public Proxy(Subject subject) {
            this.subject = subject;
        }

        public void request() {
            System.out.println("执行额外的条件判断，拷贝是否要调用subject的request()方法");
            boolean invoke = true;
            if(invoke) {
                subject.request();
            }
        }

    }

}
